package com.ruoyi.system.service.impl;

import com.ruoyi.common.utils.uuid.UUID;
import com.ruoyi.system.domain.SysPayment;
import com.ruoyi.system.mapper.SysPaymentMapper;
import com.ruoyi.system.service.ISysPaymentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

@Service
public class SysPaymentServiceImpl implements ISysPaymentService
{
    @Autowired
    private SysPaymentMapper sysPaymentMapper;

    /**
     * 查询【请填写功能名称】
     *
     * @param paymentId 【请填写功能名称】主键
     * @return 【请填写功能名称】
     */
    @Override
    public SysPayment selectSysPaymentByPaymentId(String paymentId)
    {
        return sysPaymentMapper.selectSysPaymentByPaymentId(paymentId);
    }

    /**
     * 查询【请填写功能名称】列表
     *
     * @param sysPayment 【请填写功能名称】
     * @return 【请填写功能名称】
     */
    @Override
    public List<SysPayment> selectSysPaymentList(SysPayment sysPayment)
    {
        return sysPaymentMapper.selectSysPaymentList(sysPayment);
    }

    /**
     * 新增【请填写功能名称】
     *
     * @param sysPayment 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int insertSysPayment(SysPayment sysPayment)
    {
        //去除连字符
        String id = UUID.fastUUID().toString().replaceAll("-", "");
        sysPayment.setPaymentId(id);
        //设置当前时间
        Date date = new Date(System.currentTimeMillis());
        sysPayment.setPaymentTime(date);
        return sysPaymentMapper.insertSysPayment(sysPayment);
    }

    /**
     * 修改【请填写功能名称】
     *
     * @param sysPayment 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int updateSysPayment(SysPayment sysPayment)
    {
        return sysPaymentMapper.updateSysPayment(sysPayment);
    }

    /**
     * 批量删除【请填写功能名称】
     *
     * @param paymentIds 需要删除的【请填写功能名称】主键
     * @return 结果
     */
    @Override
    public int deleteSysPaymentByPaymentIds(String[] paymentIds)
    {
        return sysPaymentMapper.deleteSysPaymentByPaymentIds(paymentIds);
    }

    /**
     * 删除【请填写功能名称】信息
     *
     * @param paymentId 【请填写功能名称】主键
     * @return 结果
     */
    @Override
    public int deleteSysPaymentByPaymentId(String paymentId)
    {
        return sysPaymentMapper.deleteSysPaymentByPaymentId(paymentId);
    }
}
